package cn.com.zsc.acr122u;

import java.lang.reflect.Method;

public class ACR122UReaderInfo {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {

		ACR122UReaderInfo info = new ACR122UReaderInfo();
		
		String acr122uInfo = info.queryCardInfo();
		
		info.writeCardInfo("Z034");
		
		System.out.println("EmplID="+acr122uInfo);
		
	}
	
	public String queryCardInfo()
	{
		String acr122uInfo = null;
		Class clazz;
		
		try {
			clazz = Class.forName("ACR122UReader");
			Object o = clazz.newInstance();
			Method m = clazz.getDeclaredMethod("queryACR122UInfo");
			acr122uInfo = (String)m.invoke(o);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			acr122uInfo = "";
		}

		if (acr122uInfo == null) {
			acr122uInfo = "";
		}
		
		return acr122uInfo;
	}
	
	public boolean writeCardInfo(String importInfo)
	{
		Class clazz;
		Boolean result = false;
		try {
			clazz = Class.forName("ACR122UReader");
			Object o = clazz.newInstance();
			
			Method m = clazz.getDeclaredMethod("writeACR122UInfo",String.class);
			
			result = (Boolean) m.invoke(o,importInfo);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
		
		return result;
	}

}
